<?php

namespace app\admin\validate;

use think\Validate;

class Goods extends Validate
{
    protected $rule = [
        "title" => "require",
        "category_id" => "require",
        "sub_title" => "require",
        "promotion_title" => "require",
        "keywords" => "require",
        "goods_unit" => "require",
        "is_show_stock" => ["require", "in"=>"0,1"],
//        "stock" => "require|integer",
        "production_time" => "require",
        "goods_specs_type" => "require","in"=>"1,2" ,
        "carousel_image" => "require",
    ];

    protected $message = [
        "title.require" => "标题不能为空",
        "category_id.require" => "分类不能为空",
        "sub_title.require" => "副标题不能为空",
        "promotion_title.require" => "推广标题不能为空",
        "keywords.require" => "关键词不能为空",
        "goods_unit.require" => "商品单位不能为空",
        "is_show_stock.require" => "是否显示库存不能为空",
        "is_show_stock.in" => "是否显示库存参数不合法",
//        "stock.require" => "库存不能为空",
//        "stock.integer" => "库存必须为整数",
        "production_time" =>"生产日期不能为空",
        "goods_specs_type" =>"商品规格类型不能为空",
        "goods_specs_type.in" =>"商品规格类型参数不合法",
        "carousel_image" => "轮播图不能为空",
    ];

    protected $scene = [
        'normal' => ["title"],

    ];
}